/*
 * @(#)MaintOptionsSetupForm.java
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */
package com.dcivision.setup.web;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionMapping;

import com.dcivision.framework.ApplicationException;
import com.dcivision.framework.TextUtility;
import com.dcivision.framework.bean.AbstractBaseObject;
import com.dcivision.framework.web.AbstractActionForm;
import com.dcivision.setup.bean.SetupOption;

/**
 *  Options Setup main form
 *
 *  @author           Kennedy Lam
 *  @company          DCIVision Limited
 *  @creation date    28/07/2003
 *  @version          $Revision: 1.2.32.1 $
 */
public class MaintOptionsSetupForm extends AbstractActionForm {

  public static final String REVISION = "$Revision: 1.2.32.1 $";


  /**
   * @return
   */
  public String getDisplaySeq() {
    return sDisplaySeq;
  }

  /**
   * @param displaySeq
   */
  public void setDisplaySeq(String displaySeq) {
    sDisplaySeq = displaySeq;
  }

  /**
   * Optional - use when option code exist
   * get the value of particular setup option item's option code column
   * @return
   */
  public String getOptionCode() {
    return sOptionCode;
  }

  /**
   * Optional - use when option code exist
   * set the value of particular setup option item's option code column
   * @param optionCode
   */
  public void setOptionCode(String optionCode) {
    sOptionCode = optionCode;
  }

  /**
   * get the value of particular setup option item's option name column
   * @return
   */
  public String getOptionName() {
    return sOptionName;
  }

  /**
   * set the value of particular setup option item's option name column
   * @param optionName
   */
  public void setOptionName(String optionName) {
    sOptionName = optionName;
  }

  /**
   * @return the name of setup option item 
   * @see com.dcivision.setup.SetupOptionItem#getOptionName();
   */
  public String getOptionsSetupName() {
    return sOptionsSetupName;
  }

  /**
   * set the name of setup option item
   * @param optionsSetupName
   * @see com.dcivision.setup.SetupOptionItem#getOptionName();
   */
  public void setOptionsSetupName(String optionsSetupName) {
    sOptionsSetupName = optionsSetupName;
  }

  /**
   * @return
   */
/*  
  public String getRecordStatus() {
    return sRecordStatus;
  }
*/
  
  /**
   * @param recordStatus
   */
/*  
  public void setRecordStatus(String recordStatus) {
    sRecordStatus = recordStatus;
  }
*/
  /**
   * @return
   */
  public String getStatus() {
    return sStatus;
  }

  /**
   * @param status
   */
  public void setStatus(String status) {
    sStatus = status;
  }

  /**
   * @return
   */
  public String getSysInd() {
    return sSysInd;
  }

  /**
   * @param sysInd
   */
  public void setSysInd(String sysInd) {
    sSysInd = sysInd;
  }

  /**
   * Default Constructor
   */
  public MaintOptionsSetupForm() {
    super();
    sSysInd = "N";
    sStatus = "A";
    this.setRecordStatus("A");
    //log.debug("DEBUG - MainOptionsSetupForm Constructor");
  }

  /**
   * Overridden method
   * @see com.dcivision.framework.web.AbstractActionForm#setFormData(com.dcivision.framework.bean.AbstractBaseObject)
   */
  
  public void setFormData(AbstractBaseObject baseObj)
    throws ApplicationException {
    
    //log.debug("DEBUG - MainOptionsSetupForm.setFormData()");
    
    SetupOption tmpSetupOption = (SetupOption) baseObj;
    this.setID(TextUtility.formatIntegerObj(tmpSetupOption.getID()));

    this.setOptionName(tmpSetupOption.getOptionName());
    this.setOptionCode(tmpSetupOption.getOptionCode());
    this.setOptionsSetupName(tmpSetupOption.getOptionsSetupName());
    this.setStatus(tmpSetupOption.getStatus());
    this.setDisplaySeq(TextUtility.formatIntegerObj(tmpSetupOption.getDisplaySeq()));
    this.setSysInd(tmpSetupOption.getSysInd());

    this.setRecordStatus(tmpSetupOption.getRecordStatus());
    this.setUpdateCount(TextUtility.formatIntegerObj(tmpSetupOption.getUpdateCount()));
    this.setCreatorID(TextUtility.formatIntegerObj(tmpSetupOption.getCreatorID()));
    this.setCreateDate(formatTimestamp(tmpSetupOption.getCreateDate()));
    this.setUpdaterID(TextUtility.formatIntegerObj(tmpSetupOption.getUpdaterID()));
    this.setUpdateDate(formatTimestamp(tmpSetupOption.getUpdateDate()));
  }

  /**
   * Overridden method
   * @see com.dcivision.framework.web.AbstractActionForm#getFormData()
   */
  
  public AbstractBaseObject getFormData() throws ApplicationException {
    
    //log.debug("DEBUG - MainOptionsSetupForm.getFormData()");
    
    SetupOption tmpSetupOption = new SetupOption();
    tmpSetupOption.setID(TextUtility.parseIntegerObj(this.getID()));
    tmpSetupOption.setOptionName(this.getOptionName());
    tmpSetupOption.setOptionCode(this.getOptionCode());
    tmpSetupOption.setOptionsSetupName(this.getOptionsSetupName());
    tmpSetupOption.setStatus(this.getStatus());
    tmpSetupOption.setDisplaySeq(TextUtility.parseIntegerObj(this.getDisplaySeq()));
    tmpSetupOption.setSysInd(this.getSysInd());

    tmpSetupOption.setRecordStatus(this.getRecordStatus());
    tmpSetupOption.setUpdateCount(TextUtility.parseIntegerObj(this.getUpdateCount()));
    tmpSetupOption.setCreatorID(TextUtility.parseIntegerObj(this.getCreatorID()));
    tmpSetupOption.setCreateDate(parseTimestamp(this.getCreateDate()));
    tmpSetupOption.setUpdaterID(TextUtility.parseIntegerObj(this.getUpdaterID()));
    tmpSetupOption.setUpdateDate(parseTimestamp(this.getUpdateDate()));
    return tmpSetupOption;
  }

  /**
   * Overridden method
   * @see org.apache.struts.action.ActionForm#reset(org.apache.struts.action.ActionMapping, javax.servlet.http.HttpServletRequest)
   */
  
  public void reset(ActionMapping mapping, HttpServletRequest request) {
    
    //log.debug("DEBUG - MainOptionsSetupForm.reset()");
    
    super.reset(mapping, request);
    this.setID(null);
    this.setRecordStatus("A");
    this.setUpdateCount(null);
    this.setCreatorID(null);
    this.setCreateDate(null);
    this.setUpdaterID(null);
    this.setUpdateDate(null);

    sOptionName = null;
    sOptionCode = null;
    sOptionsSetupName = null;
    sDisplaySeq = null;
    sSysInd = "N";
    sStatus = "A";
    
    //this.setOpMode(null);
    //this.setNavMode(null);
  }
  
  private String sOptionName;
  private String sOptionCode;
  private String sOptionsSetupName;
  private String sStatus;
  private String sDisplaySeq;
  private String sSysInd;
  //private String sRecordStatus;

}
